-
Notifications
You must be signed in to change notification settings - Fork 11
Moves back to using a List of AVars for the listeners #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess unless @natefaubion has any comments 👍 - I helped with this, so don't have anything to say 😄
kill err (Bus cell consumers) = do | ||
killVar err cell | ||
vars ← takeVar consumers | ||
traverse_ (killVar err) vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to kill consumers
as well, but doing so propagated an error all the way up now, so we dropped that part. It'll be empty anyway, so I think it's still fine.
putVar mempty consumers | ||
sequence_ (foldl (\xs a → putVar res a : xs) mempty vars) | ||
loop | ||
_ ← forkAff loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need to be an unsafe fork (liftEff <<< launchAff
) unless you want to let users to control the lifecycle of the loop with supervised
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing that line to _ ← liftEff (launchAff (forkAff loop))
explodes the tests with:
/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:513
throw util.fromLeft(step);
^
TypeError: bhead is not a function
at run (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:274:20)
at Object.run (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:623:13)
at __do (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/index.js:91:11)
at runSync (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:90:20)
at run (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:319:22)
at /home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:620:15
at drain (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:120:9)
at Object.enqueue (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:141:11)
at Object.run (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/foreign.js:619:23)
at __do (/home/creek/work/purescript-aff-bus/output/Control.Monad.Aff/index.js:91:11)
* ERROR: Subcommand terminated with exit code 1
Looks like it's maybe a bug in Aff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I'm going to merge this because we're not using |
if `var` is killed with an error, `takeVar var` will throw that same error so the loop will be terminated. note: before purescript-contrib#6 attempt was not used
We keep losing messages with the old implementation, even when using a buffered reader, so this is the previous implementation with only the updated to make it work on Aff 4.